The present invention relates to the field of computer graphics, and in particular to systems and methods for optimizing depth of field effects in computer graphics images. Many computer graphic images are created by mathematically modeling the interaction of light with a three dimensional scene from a given viewpoint. This process, called rendering, generates a two-dimensional image of the scene from the given viewpoint, and is analogous to taking a photograph of a real-world scene. Animated sequences can be created by rendering a sequence of images of a scene as the scene is gradually changed over time. A great deal of effort has been devoted to making realistic looking and artistically compelling rendered images and animations.
Many rendering effects are performed by sampling a three-dimensional scene at discrete points. The renderer determines one or more attribute values, such as color, transparency, or depth, for the sample of the three-dimensional scene. The attribute values of one or more samples of the three-dimensional scene are then combined to determine the value of a pixel of the rendered image.
For example, a renderer may trace sample rays into a three-dimensional scene (or project geometry on to an image plane) to render geometry. The intersection of a sampling ray and geometry (or an image sample point in the image plane and the projected geometry) defines a sample of the three-dimensional scene used to determine the value of a pixel of the rendered image. Additionally, illumination, shadowing, scattering, reflection, and refraction effects are created by casting additional sample rays from an intersected portion of scene geometry into further portions of the three-dimensional scene.
In another example, depth of field is a visual effect in which some portions of an image are in focus and other portions of the image are out of focus. Depth of field is the result of the aperture size of a real-world camera and the focal length of its lens system. Typical real-world cameras can only focus on objects within a range of distances, referred to as the depth of field. Objects that are within the camera's depth of field appear in focus, while object in front of or behind the depth of field appear out of focus.
Computer graphics images often mimic depth of field and other physical limitations of conventional optical and photographic equipment to achieve aesthetic effects. One prior approach places a virtual lens and/or virtual camera aperture in front of each image sample, such as a pixel or sub-pixel sample. Each image sample is assigned to a different portion of the aperture. Thus, image sample points view the three-dimensional scene through different portions of the virtual camera aperture. This blurs portions of the scene based on their distance from the focal plane, producing a depth of field effect.
One problem with these sampling-based approaches for generating effects such as illumination, shadowing, reflection, refraction, and depth of field is aliasing of distant objects. The distance between image sample point at a given distance from their origin, such as an intersection point on an object or the virtual camera, determines the image sampling rate or frequency of an object at that distance. Objects close to the origin of the sample rays are sampled by many image sample points and thus are sampled at a high image sampling frequency. As the distance between an object and the origin of the sample rays increases, the distance between image sample points in the scene increases and thus the image sampling frequency decreases. Thus, distant objects are sampled with fewer sample rays than comparable objects closer to the origin. This results in aliasing effects. For example, images of distant objects created using these depth of field effects degrade into a non-descript pixellated blurs, rather than appearing as blurry but recognizable versions of the objects.
A prior solution to aliasing is to increase the number of image sample points used to sample the three-dimensional scene and determine the final attribute values of the pixel. Increasing the number of sample rays ensures that distant objects are sampled more frequently. However, increasing the number of image sample points greatly increases the amount of time and computing resources needed to render the image. For example, doubling the number of image sample points, thereby doubling the spatial sampling frequency at a given depth, will typically double the amount of time required to render the image. Moreover, many of the additional points will sample objects close to the sampling ray origin, and thus are redundant. Additionally, for very distant objects, the number of sample rays required to make the spatial sampling rate high enough to eliminate aliasing may be greater than what is supported by the renderer and the available computing resources.
It is therefore desirable for a system and method to reduce aliasing arising from sampling three-dimensional scene data. It is further desirable that the system and method not substantially increase the time and computing resources required for rendering. It is also desirable for the system and method to operate efficiently and avoid redundant computations.